/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class DeleteBasededatosv5Data {
	public void deleteTestData() throws PersistentException {
		PersistentTransaction t = orm.Basededatosv5PersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.Trp_regionDAO lormTrp_regionDAO = lDAOFactory.getTrp_regionDAO();
			orm.Trp_region lormTrp_region = lormTrp_regionDAO.loadTrp_regionByQuery(null, null);
			// Delete the persistent object
			lormTrp_regionDAO.delete(lormTrp_region);
			orm.dao.Trp_provinciaDAO lormTrp_provinciaDAO = lDAOFactory.getTrp_provinciaDAO();
			orm.Trp_provincia lormTrp_provincia = lormTrp_provinciaDAO.loadTrp_provinciaByQuery(null, null);
			// Delete the persistent object
			lormTrp_provinciaDAO.delete(lormTrp_provincia);
			orm.dao.Trp_sexoDAO lormTrp_sexoDAO = lDAOFactory.getTrp_sexoDAO();
			orm.Trp_sexo lormTrp_sexo = lormTrp_sexoDAO.loadTrp_sexoByQuery(null, null);
			// Delete the persistent object
			lormTrp_sexoDAO.delete(lormTrp_sexo);
			orm.dao.Trp_cursoDAO lormTrp_cursoDAO = lDAOFactory.getTrp_cursoDAO();
			orm.Trp_curso lormTrp_curso = lormTrp_cursoDAO.loadTrp_cursoByQuery(null, null);
			// Delete the persistent object
			lormTrp_cursoDAO.delete(lormTrp_curso);
			orm.dao.Trp_colegioDAO lormTrp_colegioDAO = lDAOFactory.getTrp_colegioDAO();
			orm.Trp_colegio lormTrp_colegio = lormTrp_colegioDAO.loadTrp_colegioByQuery(null, null);
			// Delete the persistent object
			lormTrp_colegioDAO.delete(lormTrp_colegio);
			orm.dao.Trp_alumnoDAO lormTrp_alumnoDAO = lDAOFactory.getTrp_alumnoDAO();
			orm.Trp_alumno lormTrp_alumno = lormTrp_alumnoDAO.loadTrp_alumnoByQuery(null, null);
			// Delete the persistent object
			lormTrp_alumnoDAO.delete(lormTrp_alumno);
			orm.dao.Trp_nivelDAO lormTrp_nivelDAO = lDAOFactory.getTrp_nivelDAO();
			orm.Trp_nivel lormTrp_nivel = lormTrp_nivelDAO.loadTrp_nivelByQuery(null, null);
			// Delete the persistent object
			lormTrp_nivelDAO.delete(lormTrp_nivel);
			orm.dao.Trp_tipo_colegDAO lormTrp_tipo_colegDAO = lDAOFactory.getTrp_tipo_colegDAO();
			orm.Trp_tipo_coleg lormTrp_tipo_coleg = lormTrp_tipo_colegDAO.loadTrp_tipo_colegByQuery(null, null);
			// Delete the persistent object
			lormTrp_tipo_colegDAO.delete(lormTrp_tipo_coleg);
			orm.dao.Trp_socio_ecoDAO lormTrp_socio_ecoDAO = lDAOFactory.getTrp_socio_ecoDAO();
			orm.Trp_socio_eco lormTrp_socio_eco = lormTrp_socio_ecoDAO.loadTrp_socio_ecoByQuery(null, null);
			// Delete the persistent object
			lormTrp_socio_ecoDAO.delete(lormTrp_socio_eco);
			orm.dao.Trp_datosDAO lormTrp_datosDAO = lDAOFactory.getTrp_datosDAO();
			orm.Trp_datos lormTrp_datos = lormTrp_datosDAO.loadTrp_datosByQuery(null, null);
			// Delete the persistent object
			lormTrp_datosDAO.delete(lormTrp_datos);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			DeleteBasededatosv5Data deleteBasededatosv5Data = new DeleteBasededatosv5Data();
			try {
				deleteBasededatosv5Data.deleteTestData();
			}
			finally {
				orm.Basededatosv5PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
